package com.xpffly.design.strategy.common.service;

/**
 * @Author: xpengfei
 * @Date: 2021/4/9 21:49
 * @Description：封装角色 封装抽象的策略角色Strategy
 */
public class Context {

    /**
     * 抽象策略
     */
    private Strategy strategy = null;

    /**
     * 构造函数设置具体的策略
     *
     * @param strategy
     */
    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 封装后的策略方法
     */
    public void doAnything() {
        this.strategy.doSomething();
    }
}
